home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / enigma / earcd / emula / arosdv19.lha / AROS / exec / addtail.c < prev    next >
C/C++ Source or Header  |  1996-10-24  |  2KB  |  88 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: addtail.c,v 1.7 1996/10/24 15:50:42 aros Exp $
  4.     $Log: addtail.c,v $
  5.     Revision 1.7  1996/10/24 15:50:42  aros
  6.     Use the official AROS macros over the __AROS versions.
  7.  
  8.     Revision 1.6  1996/10/21 20:46:42  aros
  9.     Changed struct SysBase to struct ExecBase
  10.  
  11.     Revision 1.5  1996/08/13 13:55:56  digulla
  12.     Replaced AROS_LA by AROS_LHA
  13.     Replaced some AROS_LH*I by AROS_LH*
  14.     Sorted and added includes
  15.  
  16.     Revision 1.4  1996/08/01 17:41:03  digulla
  17.     Added standard header for all files
  18.  
  19.     Desc:
  20.     Lang: english
  21. */
  22. #include "exec_intern.h"
  23.  
  24. /*****************************************************************************
  25.  
  26.     NAME */
  27.     #include <exec/lists.h>
  28.     #include <clib/exec_protos.h>
  29.  
  30.     AROS_LH2I(void, AddTail,
  31.  
  32. /*  SYNOPSIS */
  33.     AROS_LHA(struct List *, list, A0),
  34.     AROS_LHA(struct Node *, node, A1),
  35.  
  36. /*  LOCATION */
  37.     struct ExecBase *, SysBase, 41, Exec)
  38.  
  39. /*  FUNCTION
  40.     Insert Node node at the end of a list.
  41.  
  42.     INPUTS
  43.     list - The list to insert the node into
  44.     node - This node is to be inserted
  45.  
  46.     RESULT
  47.  
  48.     NOTES
  49.  
  50.     EXAMPLE
  51.     struct List * list;
  52.     struct Node * pred;
  53.  
  54.     // Insert Node at end of the list
  55.     AddTail (list, node);
  56.  
  57.     BUGS
  58.  
  59.     SEE ALSO
  60.  
  61.     INTERNALS
  62.  
  63.     HISTORY
  64.     26-08-95    digulla created after EXEC-Routine
  65.     26-10-95    digulla adjusted to new calling scheme
  66.  
  67. ******************************************************************************/
  68. {
  69.     AROS_LIBFUNC_INIT
  70.     assert (node);
  71.     assert (list);
  72.  
  73.     /*
  74.     Make the node point to the head of the list. Our predecessor is the
  75.     previous last node of the list.
  76.     */
  77.     node->ln_Succ           = (struct Node *)&list->lh_Tail;
  78.     node->ln_Pred           = list->lh_TailPred;
  79.  
  80.     /*
  81.     Now we are the last now. Make the old last node point to us
  82.     and the pointer to the last node, too.
  83.     */
  84.     list->lh_TailPred->ln_Succ = node;
  85.     list->lh_TailPred           = node;
  86.     AROS_LIBFUNC_EXIT
  87. } /* AddTail */
  88.